#! /bin/bash

## 按年月取得yyyymmdd的天格式

export LC_ALL=C

month=$1
year=$2

[[ -z $month ]] && month=$( date | awk '{ print $3 }' )
[[ -z $year ]]  && year=$( date | awk '{ print $NF }' )
begin=$( cal $month $year | xargs -n1 | sed -n '10p'  )
end=$(   cal $month $year | xargs -n1 | sed -n '$p'   )
seq -w $begin $end | xargs -i'day' date '+%Y%m%d' -d ${year}-${month}-day
